﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.ComponentModel;

namespace MvcApplication2.Models
{
    [MetadataType(typeof(HighereducationMetadata))]//метаданные для класса Highereducation содержатся внутри этого класса
    public partial class Highereducation //является частью класса Highereducation
    {
       [Bind(Exclude = "id")]//не валидируем id
       public class HighereducationMetadata
       {
           [ScaffoldColumn(false)]
           public int id { get;set;}//доступно для чтения и записи
           
           [DisplayName("name")]
           [Required (ErrorMessage="Highereducation name is required.") ]//поле обязательное для заполнения
           [DisplayFormat(ConvertEmptyStringToNull=false)]//пусты строки останутся пустыми, null не пойдёт
           [StringLength(50)]
           public string name { get; set;}
           
           [DisplayName("numberfacult")]
           [DisplayFormat(ApplyFormatInEditMode=true)]
           [Required(ErrorMessage = "Highereducation numberfacult is required.")]
           [Range(1, 1000, ErrorMessage = "Highereducation name must be 1 between 1000.")]
           public int numberfacult { get; set; }
           
           [DisplayName("numberspec")]
           [DisplayFormat(ApplyFormatInEditMode = true)]
           [Required(ErrorMessage = "Highereducation numberspec is required.")]
           [Range(1, 1000, ErrorMessage = "Highereducation name must be 1 between 1000.")]
           public int numberspec { get; set; }

           [DisplayName("year")]
           [DisplayFormat(ApplyFormatInEditMode = true)]
           [Required(ErrorMessage = "Highereducation year is required.")]
           [Range(1000, 2020, ErrorMessage = "Highereducation name must be 1800 between 2020.")]
           public int year { get; set; }
       }
    }
}